<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
	
<% 
String filePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+"/file/";
%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>天祥瑞饲料</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta name="viewport" id="viewport"
	content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="format-detection" content="telephone=no" />
<link href="./css/reset.css" rel="stylesheet" type="text/css">
<link href="./css/discounts.css" rel="stylesheet" type="text/css">
<link href="./css/index.css" rel="stylesheet" type="text/css">
</head>
<body>
	<div class="near-box">
		<div class="index-bigbox">
			<!--轮播开始-->
			<div id="slideBox" class="slideBox">
				<div class="bd" id="bd">
					<ul>
						<li><a class="pic" href="#"><img id="selectHomeRotary0"
								src="" /></a></li>
						<li><a class="pic" href="#"><img id="selectHomeRotary1"
								src="" /></a></li>
						<li><a class="pic" href="#"><img id="selectHomeRotary2"
								src="" /></a></li>
						<li><a class="pic" href="#"><img id="selectHomeRotary3"
								src="" /></a></li>
					</ul>
				</div>
				<div class="hd">
					<ul></ul>
				</div>
			</div>
			<!--轮播开始-->
			<!--分类导航开始-->
			<div id="classify-menu" class="classify-menu top-menu-bar"></div>
			<!--分类导航结束-->
			<div id="bigClass"
				style="width: 100%; margin: 0 auto; overflow: hidden; background: white;">
			</div>
			<!--商品开始-->
			<div class="discounts-bigbox">

				<input id="CParentlevelidEqualTo" type="hidden"
					value="<%=request.getParameter("cId")%>">
			</div>
		</div>
		<!--bigbox结束-->
		<div class="kaola-bottom" style="z-index:9999">
			<a href="./index.jsp" class="kaola-bottom-box1"> <span
				class="kaola-bottom-img1"><img
					src="./menu/7d0199fca58e459b3da136bc50257f3.png"></span> <span
				class="kaola-bottom-text1 text2" style="color: red;">首页</span>
			</a> <a href="./online-msg.jsp" class="kaola-bottom-box1"
				style="background-color: red;"> <span class="kaola-bottom-img1"><img
					src="./menu/eec3b3a1137ca3a7d155638019db8c2.png"></span> <span
				class="kaola-bottom-text1" style="color: #f9f8f8;">留言</span>
			</a> <a href="./shoping-cart.jsp" class="kaola-bottom-box1"
				style="background-color: red;"> <span class="kaola-bottom-img1"><img
					src="./menu/1556015381.png"></span> <span
				class="kaola-bottom-text1" style="color: #f9f8f8;">购物车</span>
			</a> <a href="./personal-center.jsp" class="kaola-bottom-box1"
				style="background-color: red;"> <span class="kaola-bottom-img1"><img
					src="./menu/wodebaise.png"></span> <span class="kaola-bottom-text1"
				style="color: #f9f8f8;">我的</span>
			</a>
		</div>
	</div>

	<script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
	<script type="text/javascript" src="js/TouchSlide.1.1.js"></script>
	<script type="text/javascript" src="js/scrolltopcontrol.js"></script>
	<script>
</script>
	<script type="text/javascript">
$(function(){
	//MultiCompanyRegistration();
	
	var path="<%=filePath%>";
	selectHomeRotary(path);
	findBigClass();
	titleShow(path);
})

function MultiCompanyRegistration(){
	$.post("../../../tszs/WeChat/accessToken/MultiCompanyRegistration.do",function(data){
	},"json")
}
function selectHomeRotary(path){
	$.post("../../../tszs/txr/selectHomeRotary.do",function(data){
		$('#selectHomeRotary0').attr('src',path+data.data[0]);
		$('#selectHomeRotary1').attr('src',path+data.data[1]);
		$('#selectHomeRotary2').attr('src',path+data.data[2]);
		$('#selectHomeRotary3').attr('src',path+data.data[3]);
		 TouchSlide({ 
				slideCell:"#slideBox",
				titCell:".hd ul", //开启自动分页 autoPage:true ，此时设置 titCell 为导航元素包裹层
				mainCell:".bd ul", 
				effect:"leftLoop", 
				autoPage:true,//自动分页
				autoPlay:true, //自动播放
			});
	},"json")
}
	function findBigClass(){
		$.post("../../../tszs/txr/findBigClass.do",function(data){
			var list = data.data;
			var html = '';
			for(var i=0; i<list.length; i++) {
				var item = list[i];
				if(i != 3){
					html += "<a href=\"javascript:finds('"+item.cId+"','"+item.cName+"','"+item.cPhoto+"')\" class=\"classify-menu-box1\"><span class='classify-menu-img1'><img  style=\"width:40px; height:40px; border-radius:50%;\"  src="+item.cPhoto+" alt=\"\"></span><span class=\"classify-menu-text1\" style='text-align:center'>"+item.cName+"</span></a>";
				} else {
					html += "<a href=\"javascript:distr('"+item.cId+"','"+item.cName+"','"+item.cPhoto+"')\" class=\"classify-menu-box1\"><span class='classify-menu-img1'><img  style=\"width:40px; height:40px; border-radius:50%;\"  src="+item.cPhoto+" alt=\"\"></span><span class=\"classify-menu-text1\" style='text-align:center'>"+item.cName+"</span></a>";	
				}
			}
			$(".top-menu-bar").html(html);
		},"json")
	}
	function finds(cId,name){
		 window.location.href="discounts4.jsp?cId="+cId+"&name="+encodeURI(name);;
	}
	function distr(){
		$.post("IsDistributor.do",function(res){
			if (res.type == 0) {
				window.location.href = "distribute1.jsp?id="+res.data;
			} else {
				window.location.href="distribute.jsp";
			}
		},"json")
	}
	function find(cId,name,photo){
		 window.location.href="discounts.jsp?cId="+cId+"&name="+name+"&photo="+photo;
	}
	function titleShow(path){
		$.post("../../../tszs/txr/titleShow.do",function(data){
			var html="";
			var subHtml="";
			var allhtml="";
	 		for (var i = 0; i < data.data.length; i++) {
	 			html="<div class=\"brand-box1\"><a href=\"javascript:find('"+data.data[i].pid+"','"+data.data[i].cname+"','"+path+data.data[i].pphoto+"')\">"+
	 			"<span class=\"brand-line1\"></span>"+
	 		 	  "<span class=\"brand-text1\">"+data.data[i].cname+"</span>"+
	 		 	"<span class=\"brand-line2\"></span>"+
	 		 "</div><div class=\"special-sale-banner\">"+
	 	 	 "<img src="+path+data.data[i].pphoto+" >"+
	 		 	 "<a></div>";
				   for (var c = 0; c < data.data[i].datas.length; c++) {
					   subHtml="<div class=\"special-sale-box4\"><a href=\"javascript:findShopDatails('"+data.data[i].datas[c].sid+"')\">"+
					 	 	 "<div class=\"special-sale-img1\"><img src="+path+data.data[i].datas[c].sphoto.split(",")[0]+"></div>"+
					 	 	 "<div class=\"special-sale-tbox\">"+data.data[i].datas[c].sname+"</div>"+
					 	 	 "<div class=\"special-sale-text2\">￥"+data.data[i].datas[c].sprice+"</div>"+
					 	 "</a></div>";
				  html+=subHtml;
						}
				   allhtml+=html;
			}
 	 		$("#bigClass").append(allhtml);
		},"json")
	}
	function findShopDatails(cid){
		 window.location.href="goods-details.jsp?cid="+cid;
	}
</script>
</body>
</html>